<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>demo</title>
<%    pageContext.setAttribute("APP_PATH",request.getContextPath());    %>
<link rel="stylesheet" href="${APP_PATH}/static/bootstrap-fileinput-5.0.4/css/fileinput.css" />
    <link rel="stylesheet" href="${APP_PATH}/static/bootstrap-3.3.7/css/bootstrap.min.css" >
	<script type="text/javascript" src="${APP_PATH}/static/js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript" src="${APP_PATH}/static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="${APP_PATH}/static/bootstrap-fileinput-5.0.4/js/fileinput.js"></script>
</head>
<body>
<form>
<input id="uploadFile" type="file" name='file'class='file' accept=".xls,.xlsx" data-show-upload="false" data-show-cancel="false" data-show-preview="false" >
<button type="submit" id="upload">确定提交</button>
</form>
<script type="text/javascript">
$("#upload").click(function(){
	var formData = new FormData();
	if($("#uploadFile")[0].files[0]!=null){
	formData.append("files", $("#uploadFile")[0].files[0]);
	$.ajax({
		url:"${APP_PATH}/upload",
		type:'POST',
		data:formData,
		processData : false,
        contentType : false,
        dataType: "json",
        success: function (data) {
            debugger;
            if (200 == data.code) {
                /*Feng.success("保存成功!");
            window.parent.Consult.table.refresh();
            ConInfoDlg.close();*/
            } else {
                /*Feng.error("保存失败!" + data.message);*/
            }}});
	}else{
		alert("请选择文件后再提交");
	}
});
</script>
</body>
</html>